<?php
namespace DB\Unity;

/**
 *
 * @author Administrator
 *        
 */
class DbUnity
{
    protected static $cache = array(); // 连接池
    protected static $conf = array(); // 配置
    protected $conn = null; // mysqli 对象
    /**
     * 实例化对象
     * 
     * @param unknown $conn            
     */
    protected function __construct ($conn){
        
    }

    /**
     * 方法和参数
     * 
     * @param unknown $method            
     * @param unknown $argvs            
     */
    protected function __call ($method, $argvs){}

    /**
     * 选择数据库
     * 
     * @param string $dbname            
     */
    protected function selectDB ($dbname = ''){}

    /**
     * 获取数据库配置
     * 
     * @param unknown $conn            
     */
    protected function getConf ($conn){
        
    }

    /**
     * 初始化DB连接
     * 
     * @param unknown $conn            
     */
   public static function instance ($conn){
        if(empty(self::$cache[$conn])){
            self::$cache[$conn] = new $conn['db_tyle']($conn);
        }
        return self::$cache[$conn];
    }
}

//end class DbUnity.php